#include "main/utils.h"
using namespace std;

int main() {
  vector<int> vec = {6, 1, 2, 5, 3, 4};
  printVec("origin vec", vec);

  make_heap(vec.begin(), vec.end());
  printVec("make_heap", vec);

  make_heap(vec.begin(), vec.end(), greater<int>());
  printVec("make_heap", vec);

  vec.push_back(200);
  push_heap(vec.begin(), vec.end(), greater<int>());
  printVec("push_heap", vec);

  pop_heap(vec.begin(), vec.end(), greater<int>());
  std::cout << vec.back() << std::endl;
  printVec("pop_heap", vec);

  make_heap(vec.begin(), vec.end());
  sort_heap(vec.begin(), vec.end());
  printVec("sort_heap", vec);

  cout << is_heap(vec.begin(), vec.end()) << endl;
  make_heap(vec.begin(), vec.end());
  cout << is_heap(vec.begin(), vec.end()) << endl;

  auto tmp1 = is_heap_until(vec.begin(), vec.end());
  cout << (tmp1 == vec.end()) << endl;
  vec.push_back(100);
  printVec("is_heap_until", vec);
  auto tmp2 = is_heap_until(vec.begin(), vec.end());
  cout << *tmp2 << endl;

  return 0;
}
